<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('phone')->nullable()->unique()->comment('手机号');
            $table->string('email')->nullable()->unique()->comment('邮箱');
            $table->string('avatar')->nullable()->comment('用户头像');
            $table->string('username')->unique()->comment('用户名');
            $table->string('nikename')->nullable()->comment('用户名称');
            $table->string('wechat')->nullable()->unique()->comment('微信登录标识');
            $table->decimal('balance', 10, 2)->nullable()->comment('余额');
            // $table->foreignId('role_id')->nullable()->constrained()->onDelete('set null')->comment('用户角色ID');
            $table->string('status')->default('1')->comment('用户状态 1/正常 0/禁用');
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password')->comment('密码');
            $table->decimal('integral', 10, 2)->nullable()->comment('用户积分');
            $table->timestamp('login_time')->comment('登录时间');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};
